class Task < ActiveRecord::Base
  belongs_to :event
  belongs_to :category

  validates_presence_of :description, :message => "must be present."
  validates_format_of :priority, :with => /^[0-9]+$/, :allow_nil => true, :message => "must be numeric."

  before_save :cleanupTask

  def cleanupTask
    if self.priority.nil?
      self.priority = 0
    end
  end

end
